import { ref, toRefs } from 'vue';
import { getDictList } from '@/api/sys' //引入封装数字字典接口

/**
 * 获取字典数据
 */
export function getDict(...args) {
    const res = ref({});
    return (() => {
        args.forEach((d, index) => {
            res.value[d] = [];
            getDictList(d).then(result => {
                res.value[d] = result.data.body.map(p => ({ label: p.dictLabel, value: p.dictValue, elTagType: p.dictType }));
            })
        })
        return toRefs(res.value);
    })()
}